package phone.qyg.com.qyg.adapter;

import android.content.Context;

import com.app.adapter.recycler.MultiItemTypeAdapter;
import com.app.adapter.recycler.base.ItemViewDelegate;
import com.app.adapter.recycler.base.ViewHolder;

import java.util.List;

import phone.qyg.com.qyg.R;
import phone.qyg.com.qyg.model.Base;

/**
 * 作者：lblbh on 2018/1/5 11:37
 * 邮箱：lanbuhan@163.com
 * 功能：文化超市筛分项
 */

public class CultureTypeAdapter extends MultiItemTypeAdapter<Base> {

    public CultureTypeAdapter(Context context, List<Base> datas) {
        super(context, datas);
        addItemViewDelegate(new ActAdapter());
    }

    public class ActAdapter implements ItemViewDelegate<Base> {

        @Override
        public int getItemViewLayoutId() {
            return R.layout.item_culture_type;
        }

        @Override
        public boolean isForViewType(Base item, int position) {
            return (item instanceof Base);
        }

        @Override
        public void convert(ViewHolder holder, Base model, int position) {
            holder.setText(R.id.item_type, model.title);
            //0隐藏 1显示
            int hintType = model.hintType;
            holder.setTextColorRes(R.id.item_type, (hintType == 0)?R.color.black:R.color.login_fill_btn);
            holder.setBackgroundRes(R.id.item_type,(hintType == 0)?R.drawable.ash_white_fill_frame:R.drawable.blue_white_fill_frame);

        }
    }
}